-- 获取物品，降低生成物品卡顿
function c_give(prefab, count)
    count = type(count) == "number" and count > 0 and count or 1

    local MainCharacter = GetPlayer()
    if MainCharacter then
        for _, inst in pairs(XS:CreatePrefabEntity(prefab, count, XS:GetPosition(MainCharacter))) do
            if inst then
                MainCharacter.components.inventory:GiveItem(inst)
            end
        end
    end
end
